<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>为视图引擎分配一个模板变量</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="yaf-view-simple.render.html">Yaf_View_Simple::render</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="yaf-view-simple.setscriptpath.html">Yaf_View_Simple::setScriptPath</a></div>
 <div class="up"><a href="class.yaf-view-simple.html">Yaf_View_Simple</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="yaf-view-simple.set" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Yaf_View_Simple::__set</h1>
  <p class="verinfo">(Yaf &gt;=1.0.0)</p><p class="refpurpose"><span class="refname">Yaf_View_Simple::__set</span> &mdash; <span class="dc-title">为视图引擎分配一个模板变量</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-yaf-view-simple.set-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type"><span class="type void">void</span></span> <span class="methodname"><strong>Yaf_View_Simple::__set</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span>
   , <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$value</code></span>
   )</div>

  <p class="para rdfs-comment">
    这是一个更简单并且用来替代 <span class="methodname"><a href="yaf-view-simple.assign.html" class="methodname">Yaf_View_Simple::assign()</a></span> 的方法
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-yaf-view-simple.set-parameters">
  <h3 class="title">参数</h3>
  <dl>

   
    <dt>
<em><code class="parameter">name</code></em></dt>

    <dd>

     <p class="para">
       一个字符串值的名字
     </p>
    </dd>

   
   
    <dt>
<em><code class="parameter">value</code></em></dt>

    <dd>

     <p class="para">
      Mixed value.
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-yaf-view-simple.set-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-yaf-view-simple.set-examples">
  <h3 class="title">范例</h3>
  <div class="example" id="example-4049">
   <p><strong>Example #1 <span class="function"><strong>Yaf_View_Simple::__set()</strong></span>example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">class&nbsp;</span><span style="color: #0000BB">IndexController&nbsp;</span><span style="color: #007700">extends&nbsp;</span><span style="color: #0000BB">Yaf_Controller_Abstract&nbsp;</span><span style="color: #007700">{<br />&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;</span><span style="color: #0000BB">indexAction</span><span style="color: #007700">()&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getView</span><span style="color: #007700">()-&gt;</span><span style="color: #0000BB">foo&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"bar"</span><span style="color: #007700">;&nbsp;</span><span style="color: #FF8000">//&nbsp;same&nbsp;as&nbsp;assign("foo",&nbsp;"bar");<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-yaf-view-simple.set-seealso">
  <h3 class="title">参见</h3>
  <ul class="simplelist">
   <li class="member"><span class="methodname"><a href="yaf-view-simple.assignref.html" class="methodname" rel="rdfs-seeAlso">Yaf_View_Simple::assignRef()</a> - The assignRef purpose</span></li>
   <li class="member"><span class="methodname"><a href="yaf-view-interface.assign.html" class="methodname" rel="rdfs-seeAlso">Yaf_View_Interface::assign()</a> - 为视图引擎分配一个模板变量</span></li>
  </ul>                       
 </div>
  

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="yaf-view-simple.render.html">Yaf_View_Simple::render</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="yaf-view-simple.setscriptpath.html">Yaf_View_Simple::setScriptPath</a></div>
 <div class="up"><a href="class.yaf-view-simple.html">Yaf_View_Simple</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
